//
//  BillListCell.m
//  cm
//
//  Created by suyibaishan on 2017/11/6.
//  Copyright © 2017年 feihu. All rights reserved.
//

#import "BillListCell.h"

@implementation BillListCell
{
    UILabel *timeLabel;
    UILabel *awardLabel;
    UILabel *priceLabel;
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self constructUI];
    }
    return self;
}

-(void)constructUI
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(15, 0, kScreenWidth - 30, 60)];
    view.layer.borderWidth = 0.5;
    view.layer.borderColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1].CGColor;
    [self.contentView addSubview:view];
    
    timeLabel = [[UILabel alloc] init];
    timeLabel.textAlignment = NSTextAlignmentCenter;
    timeLabel.numberOfLines = 2;
    timeLabel.textColor = [UIColor blackColor];
//    timeLabel.text = @"201708/07";
    timeLabel.font = [UIFont systemFontOfSize:14];
    [view addSubview:timeLabel];
    timeLabel.sd_layout
    .leftSpaceToView(view, 0)
    .topSpaceToView(view, 10)
    .widthIs((kScreenWidth-30)/3)
    .heightIs(40);
    
    awardLabel = [[UILabel alloc] init];
    awardLabel.textAlignment = NSTextAlignmentCenter;
    awardLabel.textColor = [UIColor blackColor];
    awardLabel.numberOfLines = 2;
//    awardLabel.text = @"直荐奖励";
    awardLabel.font = [UIFont systemFontOfSize:14];
    [view addSubview:awardLabel];
    awardLabel.sd_layout
    .leftSpaceToView(timeLabel, 0)
    .topSpaceToView(view, 10)
    .widthIs((kScreenWidth-30)/3)
    .heightIs(40);
    
    priceLabel = [[UILabel alloc] init];
    priceLabel.textAlignment = NSTextAlignmentCenter;
    priceLabel.textColor = [UIColor blackColor];
    priceLabel.numberOfLines = 2;
//    priceLabel.text = @"2000";
    priceLabel.font = [UIFont systemFontOfSize:14];
    [view addSubview:priceLabel];
    priceLabel.sd_layout
    .leftSpaceToView(awardLabel, 0)
    .topSpaceToView(view, 10)
    .widthIs((kScreenWidth-30)/3)
    .heightIs(40);
}

-(void)setModel:(BillListModel *)model
{
    timeLabel.text = model.time;
    awardLabel.text = model.name;
    priceLabel.text = [NSString stringWithFormat:@"%.2f",model.price];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
